package contacts530.db;



	import java.sql.*;
	 
	public class Dbconnection {
	 public static void main(String [] args)
	 {
	  Connection conn;
	  String driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver";
	  String dbURL="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=contactsdb";//test为你的数据库名
	  String userName="sa";//你的数据库用户名
	  String userPwd="zyn416427";//你的密码
	 try
	{
	    Class.forName(driverName);
	    System.out.println("加载驱动成功！");
	}catch(Exception e){
	    e.printStackTrace();
	    System.out.println("加载驱动失败！");
	}
	try{
	    Connection dbConn=DriverManager.getConnection(dbURL,userName,userPwd);
	        System.out.println("连接数据库成功！");
	}catch(Exception e)
	{
	    e.printStackTrace();
	    System.out.print("SQL Server连接失败！");
	}        
	}

	/**
	 * @return 
	 */
	public static Connection getConnection() {
		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * @param object
	 * @param ps
	 */
	public static void close(Object object, PreparedStatement ps) {
		// TODO Auto-generated method stub
		
	}

	/**
	 * @param ps
	 * @param rs
	 */
	public static void close(PreparedStatement ps, ResultSet rs) {
		// TODO Auto-generated method stub
		
	}
	 
	}
//